<?php
	require("../scripts/common.php");
	if (cleanparam("ft") == "true") {
		membersdb();
		if (mysql_num_rows(mysql_query("SELECT * FROM members WHERE memberName='$name'"))) {
			echo "This name is already taken.  Please choose a different one.";
			return;
		}
		else //enter it into the database
			mysql_query("INSERT INTO members (memberName,memberPassword,wordWaffle) VALUES ('$name','$password',1)");
	}
	$results = checkLogin(cleanparam("name"),md5(cleanparam("pass")),"wordWaffle");
	switch ($results) {
		case -3:
			echo "Login failed.";
			break;
		case -2:
			echo "Account suspended.";
			break;
		case -1:
			echo "Login failed.";
			break;
		default:
			echo $results;
	}
?>